home *** CD-ROM | disk | FTP | other *** search
/ HPAVC / HPAVC CD-ROM.iso / pc / ABUSESRC.ZIP / AbuseSrc / imlib / port / dos4gw / ipxdocs < prev    next >
Encoding:
Text File  |  1995-07-23  |  4.4 KB  |  174 lines

  1. /*******************************************************************
  2.  
  3.   IPXLIB.C V1.00
  4.   Copyright (c) 1992 by Kurt Duncan - All Rights Reserved
  5.  
  6.   Library of functions based on the Novell IPX transport mechanism
  7.   Watcom'ed by Simeon Pashley (simeon@krisalis.demon.co.uk)
  8. *******************************************************************/
  9.  
  10. #include <string.h>
  11. #include <stdio.h>
  12. #include <dos.h>
  13. #include "ipxlib.h"
  14. #include "dos32.h"
  15.  
  16. struct rminfo RMI;
  17.  
  18. /***********************************************************************
  19.   IPX_Is_Loaded
  20. ***********************************************************************/
  21. word IPX_Is_Loaded (void)
  22. {
  23.     RMI.EAX=0x7a00;
  24.     RMInt(0x2f, RMI);
  25.  
  26.     if (0xFF != (byte)RMI.EAX)
  27.         return (0);
  28.     return (1);
  29. }
  30.  
  31. /***********************************************************************
  32.   IPX_Open_Socket
  33. ***********************************************************************/
  34.  
  35. word IPX_Open_Socket (word Socket_Number)
  36. {
  37.     RMI.EBX=0x00;            /* IPX function 00h */
  38.     RMI.EAX=0x00;            /* Longevity code 00h (close at end of pgm) */
  39.     RMI.EDX=IPX_Flipword (Socket_Number);
  40.     RMInt(0x7a, RMI);
  41.  
  42.     return ((byte)RMI.EAX);
  43. }
  44.  
  45. /***********************************************************************
  46.   IPX_Close_Socket
  47. ***********************************************************************/
  48.  
  49. void IPX_Close_Socket (word Socket_Number)
  50. {
  51.     RMI.EBX=0x00;            /* IPX function 01h */
  52.     RMI.EDX=IPX_Flipword (Socket_Number);
  53.     RMInt(0x7a, RMI);
  54. }
  55.  
  56. /***********************************************************************
  57.   IPX_Get_Local_Target
  58. ***********************************************************************/
  59.  
  60. word IPX_Get_Local_Target (struct IPX_address *Destination,
  61.                                    struct IPX_node    *Target)
  62. {
  63.     int     iSegment, iDestOff, iTargetOff;
  64.  
  65.     if ((int)Destination < (int)Target)
  66.         iSegment=D32RealSeg(Destination);
  67.     else
  68.         iSegment=D32RealSeg(Target);
  69.  
  70.     iDestOff=(int)Destination-(16*iSegment);
  71.     iTargetOff=(int)Target-(16*iSegment);
  72.  
  73.     /* Set up real-mode call structure */
  74.     memset(&RMI, 0, sizeof(RMI));
  75.     RMI.EBX    = 0x02;
  76.     RMI.ES    = iSegment;
  77.     RMI.ESI    = iDestOff;
  78.     RMI.EDI    = iTargetOff;
  79.     RMInt(0x7a, RMI);
  80.  
  81.     return (RMI.ECX);
  82. }
  83.  
  84. /***********************************************************************
  85.   IPX_Send_Packet
  86. ***********************************************************************/
  87.  
  88. void IPX_Send_Packet (struct IPX_ECB *ECB)
  89. {
  90.     /* Set up real-mode call structure */
  91.     memset(&RMI, 0, sizeof(RMI));
  92.     RMI.EBX    = 0x03;
  93.     RMI.ES    = D32RealSeg(ECB);
  94.     RMI.ESI    = D32RealOff(ECB);
  95.     RMInt(0x7a, RMI);
  96. }
  97.  
  98. /***********************************************************************
  99.   IPX_Listen_For_Packet
  100. ***********************************************************************/
  101.  
  102. void IPX_Listen_For_Packet (struct IPX_ECB *ECB)
  103. {
  104.     /* Set up real-mode call structure */
  105.     memset(&RMI, 0, sizeof(RMI));
  106.     RMI.EBX    = 0x04;
  107.     RMI.ES    = D32RealSeg(ECB);
  108.     RMI.ESI    = D32RealOff(ECB);
  109.  
  110.     RMInt(0x7a, RMI);
  111. }
  112.  
  113. /***********************************************************************
  114.   IPX_Cancel_Event
  115. ***********************************************************************/
  116.  
  117. void IPX_Cancel_Event (struct IPX_ECB *ECB)
  118. {
  119.     /* Set up real-mode call structure */
  120.     memset(&RMI, 0, sizeof(RMI));
  121.     RMI.EBX    = 0x06;
  122.     RMI.ES    = D32RealSeg(ECB);
  123.     RMI.ESI    = D32RealOff(ECB);
  124.  
  125.     RMInt(0x7a, RMI);
  126. }
  127.  
  128. /***********************************************************************
  129.   IPX_Get_Internetwork_Address
  130. ***********************************************************************/
  131.  
  132. void IPX_Get_Internetwork_Address (struct IPX_address *Address)
  133. {
  134.     /* Set up real-mode call structure */
  135.     memset(&RMI, 0, sizeof(RMI));
  136.     RMI.EBX    = 0x09;
  137.     RMI.ES    = D32RealSeg(Address);
  138.     RMI.ESI    = D32RealOff(Address);
  139.  
  140.     RMInt(0x7a, RMI);
  141. }
  142.  
  143. /***********************************************************************
  144.   IPX_Relinquish_Control
  145. ***********************************************************************/
  146.  
  147. void IPX_Relinquish_Control (void)
  148. {
  149.     RMI.EBX=0x0A;            /* IPX function 0Ah */
  150.     RMInt(0x7a, RMI);
  151. }
  152.  
  153. /***********************************************************************
  154.   IPX_Flipword
  155. ***********************************************************************/
  156.  
  157. word IPX_Flipword (word Inword)
  158. {
  159.     byte c1, c2;
  160.     c1 = Inword >> 8;
  161.     c2 = Inword & 0xFF;
  162.     return ( (word) (c2 << 8) | c1);
  163. }
  164.  
  165.  
  166.  
  167.  
  168.  
  169.  
  170.  
  171.  
  172.  
  173.  
  174.